import bisect
import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n, m, k = map(int, input().split())
u = [[0, m + 1] for _ in range(n + 1)]
v = [[0, n + 1] for _ in range(m + 1)]
for _ in range(k):
x, y = map(int, input().split())
u[x].append(y)
v[y].append(x)
for i in range(1, n + 1):
u[i].sort()
for i in range(1, m + 1):
v[i].sort()
c = 1
i, j = 1, 1
l = 0
if len(u[1]) > 1 and u[1][1] == 2:
l = 1
inf = pow(10, 9) + 1
z = [inf, inf, -inf, -inf]
while True:
if l == 0:
x = min(u[i][bisect.bisect_left(u[i], j)], z[0])
d = x - j - 1
j = x - 1
z[3] = i
elif l == 1:
x = min(v[j][bisect.bisect_left(v[j], i)], z[1])
d = x - i - 1
i = x - 1
z[0] = j
elif l == 2:
x = max(u[i][bisect.bisect_left(u[i], j) - 1], z[2])
d = j - x - 1
j = x + 1
z[1] = i
else:
x = max(v[j][bisect.bisect_left(v[j], i) - 1], z[3])
d = i - x - 1
i = x + 1
z[2] = j
if not d:
break
c += d
l += 1
l %= 4
ans = "Yes" if n * m - c == k else "No"
print(ans)
1609C - Complex Market Analysis | 1657E - Star MST |
1143B - Nirvana | 1285A - Mezo Playing Zoma |
919B - Perfect Number | 894A - QAQ |
1551A - Polycarp and Coins | 313A - Ilya and Bank Account |
1469A - Regular Bracket Sequence | 919C - Seat Arrangements |
1634A - Reverse and Concatenate | 1619C - Wrong Addition |
1437A - Marketing Scheme | 1473B - String LCM |
1374A - Required Remainder | 1265E - Beautiful Mirrors |
1296A - Array with Odd Sum | 1385A - Three Pairwise Maximums |
911A - Nearest Minimums | 102B - Sum of Digits |
707A - Brain's Photos | 1331B - Limericks |
305B - Continued Fractions | 1165B - Polycarp Training |
1646C - Factorials and Powers of Two | 596A - Wilbur and Swimming Pool |
1462B - Last Year's Substring | 1608B - Build the Permutation |
1505A - Is it rated - 2 | 169A - Chores |